//
//  UIImage+Color.h
//  iOS-Categories (https://github.com/shaojiankui/iOS-Categories)
//
//  Created by Jakey on 14/12/15.
//  Copyright (c) 2014年 www.skyfox.org. All rights reserved.
//

typedef NS_ENUM(int,EShapeType){
    EShapeTypeAdd   =   0,
    EShapeTypeMinus =   1,
};

typedef NS_ENUM(int,EShapeLocation){
    EShapeLocationTopLeft       =   1   <<  0,  //左上角
    EShapeLocationTopRight      =   1   <<  1,  //右上角
    EShapeLocationBottomLeft    =   1   <<  2,  //左下角
    EShapeLocationBottomRight   =   1   <<  3,  //右下角
    EShapeLocationCenter        =   1   <<  4,  //中心
};

#import <UIKit/UIKit.h>

@interface UIImage (Color)
+ (UIImage *)imageWithColor:(UIColor *)color;
- (UIColor *)colorAtPoint:(CGPoint )point;
///< more accurate method ,colorAtPixel 1x1 pixel
- (UIColor *)colorAtPixel:(CGPoint)point;
///< 返回该图片是否有透明度通道
- (BOOL)hasAlphaChannel;

///< 获得灰度图
+ (UIImage*)covertToGrayImageFromImage:(UIImage*)sourceImage;


+ (UIImage *)imageWithColor:(UIColor *)color frame:(CGRect)frame;

/**
 获得渐变效果的图片
 * @param colors 颜色数组(UIColor\ColorString)
 * @param locations 色值范围{0.1，0.5，1.0}
 * @param 填充方式
 * @param  size 填充区域
 
 * @return 填充后的图片
 */
//+ (UIImage *)imageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType size:(CGSize)size;
//+ (UIImage *)imageFromColors:(NSArray*)colors locations:(CGFloat[])locations gradientType:(GradientType)gradientType size:(CGSize)size;
/**
 * 重置图片内容颜色
 */
- (UIImage *) imageWithTintColor:(UIColor *)tintColor;

/**
 * 重置图片内容颜色（中间向外有放射效果）
 */
- (UIImage *) imageWithGradientTintColor:(UIColor *)tintColor;

/**
 * 重置图片内容颜色，自己设置效果
 */
- (UIImage *) imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode;


/**
 *  制作圆角图片
 *
 *  @param cornerRadius 圆角大小
 *  @param original     原始图片
 *
 *  @return 带圆角的图片
 */
- (UIImage *)imageWithRoundedCornersSize:(float)cornerRadius
                              usingImage:(UIImage *)original;




@end
